import { ColumnProps } from '~/library/components/ProTable/interface'
import { Inventory } from '~/src/api/interface/goods'
import { Procure } from '~/src/api/interface/procure'
import { formatDate } from '~/src/utils/date-formatter'

export const stockRealSheetColumn: ColumnProps<Procure.StockRealSheet>[] = [
  {
    type: 'index',
    label: '序号',
    width: 60,
    search: {
      el: 'date-picker',
      label: '单据日期',
      key: 'date',
      order: 1,
      defaultValue: [formatDate(-30, 'start', 'yyyy-MM-dd'), formatDate(0, 'end', 'yyyy-MM-dd')],
      props: {
        type: 'datetimerange',
        format: 'YYYY-MM-DD',
        valueFormat: 'YYYY-MM-DD',
      },
    },
  },
  {
    sortable: true,
    prop: 'orderNo',
    label: '单据号',
    // search 配置是否可以通过上面搜索框搜索到数据
    search: {
      el: 'input',
    },
  },
  {
    sortable: true,
    prop: 'checkFlagName',
    label: '单据状态',
    isFilterEnum: false,
    width: 120,
    enum: [
      { label: '未审核', value: false },
      { label: '已审核', value: true },
    ],
    search: {
      el: 'select',
      key: 'checkFlag',
    },
  },
  {
    sortable: true,
    prop: 'quantity',
    label: '数量',
    width: 100,
  },
  {
    sortable: true,
    prop: 'amount',
    label: '金额',
    width: 120,
  },
  {
    sortable: true,
    prop: 'sysUserName',
    label: '制单人',
    width: 130,
  },
  {
    sortable: true,
    prop: 'createTime',
    label: '制单时间',
  },
  {
    sortable: true,
    prop: 'checkerName',
    label: '审核人',
    width: 120,
  },
  {
    sortable: true,
    prop: 'checkTime',
    label: '审核时间',
  },
  // {
  //      sortable: true, prop: "printStatusName",
  //   label: "打印状态",
  //   width: 100
  // },
  {
    prop: 'operation',
    width: 100,
    label: '操作',
  },
]
export const stockRealEditColumn: ColumnProps<Inventory.ResPurchaseList>[] = [
  { type: 'index', label: '序号', width: 60 },
  { prop: 'operate', label: '操作', width: 100 },
  { prop: 'barcode', label: '编码', minWidth: 220 },
  { prop: 'name', label: '名称', minWidth: 140 },
  { prop: 'realQuantity', label: '盘点数量', minWidth: 140 },
  { prop: 'planQuantity', label: '账面数量', minWidth: 120 },
  { prop: 'costPrice', label: '成本价', minWidth: 120 },
  { prop: 'costAmount', label: '库存金额', minWidth: 120 },
  { prop: 'profitLossQuantity', label: '盈亏数量', minWidth: 100 },
  { prop: 'profitLossAmount', label: '盈亏金额', minWidth: 100 },
  { prop: 'productName', label: '分类', minWidth: 100 },
  { prop: 'unitName', label: '单位', minWidth: 120 },
]
